package animation6.view.zhaolixiang.com.viewanimation6

import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.view.animation.AccelerateDecelerateInterpolator
import android.view.animation.AccelerateInterpolator
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val valueAnimator=ValueAnimator.ofObject(CharEvaluator(),'A','Z')
        valueAnimator.duration=5000
        valueAnimator.interpolator= AccelerateInterpolator()
        valueAnimator.addUpdateListener {
            animator->
           tv_title.text= animator.animatedValue.toString()
        }
        bt_char.setOnClickListener{
            valueAnimator.start()
        }
        bt_point.setOnClickListener{
            myPointView.doAnimation(20f,200f)
        }
    }
}
